<?php 
## include required files
/*******************************/
require_once '../model/webcode.php';
/*******************************/

## Create Objects
/*******************************/
$webObj = new Model_Webcode();
/*******************************/
if(isset($_POST['addfaq_btn'])) {
	## apply PHP validation for required filed
	if(trim($_POST['verified_name']) != '' && trim($_POST['verified_code']) != '') {
		$webArray = array();
		extract($_POST);
		$webArray['verified_name']   = return_post_value($verified_name);
		$webArray['verified_code']   = return_post_value($verified_code);
		$webArray['status']   = 1;
		$webObj->addWebcode($webArray);
		$_SESSION['msg'] = "<div class='success_msg'><span>Website Verification details added successfully</span></div>";
		header('location:'.SITE_URL.'/admin/home.php?q=webcode');
		exit;
	} else { // php validation else
		$_SESSION['msg'] = '<div class="error_msg"><span>Please enter website verification details</span></div>';
	}
	// main if closed
}

## Assign success or error msg to smarty variable and unset session variable
if(trim($_SESSION['msg']) != '') {
	$smarty->assign('msg', $_SESSION['msg']);
	unset($_SESSION['msg']);
}

## Set active class variable for left menu
$smarty->assign('activeclass', 'webcode');
$smarty->assign('mainmenu', '6');
## Unset all the objects created which are on this page
unset($webObj);

$smarty->display(TEMPLATEDIR_ADMIN. 'websiteverification/addwebcode.tpl');
unset($smarty);
?>